# represents a UNC PID
class Pid:
# TODO: fail constructor if length(scan) != 9
# TODO: fail constructor if all scan not string.digits

    def __init__(self, scan):
#        self.pidNum  = scan
        self.__valid__  = False
        self.__str__ = ''
        try:
            if scan == '':
                return
            else:
                self.__str__ = int(scan)
                self.__valid__  = True
        except ValueError:
            pass

    def getStr(self):
        return(self.__str__)

    def isValid(self):
        return(self.__valid__)

    def matches(self, cand):
        # ASSERT: cand isa Pid
#         try:
#             print "self='%s', cand='%s', cmp=%d" % (self.__str__, cand.getStr(), cmp(self.__str__, cand.getStr()))
        return(\
            self.__valid__ and \
            cand.isValid() and \
            cmp(self.__str__, cand.getStr()) == 0)
#         except ValueError:
#             pass
